<template>
  <div>
    <el-table border
      class="inputcolumn"
      :data="selectedDataCopy"
      style="width: 1000px">

      <el-table-column label="套餐卡主图"
        align="center"
        prop="cardMainImage"
        width="130">
        <template slot-scope="scope">
          <el-image v-if="scope.row.cardMainImage != null && scope.row.cardMainImage != ''"
            slot="reference"
            :src="scope.row.cardMainImage"
            class="image-rows"
            :preview-src-list="[scope.row.cardMainImage]">
          </el-image>
        </template>
      </el-table-column>
      <el-table-column label="套餐卡名称"
        align="left"
        prop="cardName"
        width="240">
        <template slot-scope="scope">
          <a style="color: #1890ff;"
            @click="handledetail(scope.row)">{{ scope.row.cardName }}
          </a>
        </template>
      </el-table-column>
      <el-table-column label="面价"
        align="center"
        prop="cardPriceStr"
        sortable
        width="100" />
      <el-table-column label="活动价格"
        align="center"
        prop="cardFavorablePriceStr"
        sortable
        width="100" />
      <el-table-column label="结算价格"
        align="center"
        prop="cardSettlementPriceStr"
        sortable
        width="100" />
      <el-table-column label="项目类别"
        align="center"
        prop="cardTypeStr"
        width="100" />
      <el-table-column label="是否投放门店"
        align="center"
        prop="isCommon"
        width="100">
        <template slot-scope="scope">
          <span>{{ scope.row.isCommon == '1' ? '通用' : '指定门店' }}</span>
        </template>
      </el-table-column>

      <el-table-column align="center"
        prop="receiveNumber"
        label="操作"
        v-if="canDelete">
        <template slot-scope="scope">
          <el-button size="mini"
            @click="handleDeleteser(scope.$index, scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>
<script>
export default {
  props: {
    selectedData: {
      type: Object,
      default: function () {
        return {}
      }
    },
    canDelete: {
      type: Boolean,
      default: true
    }
  },
  data () {
    return {
      selectedDataCopy: [],
      pageSizess: [5, 10, 15, 20, 25, 30, 50],
      pageNum: 1,
      pageSize: 5,

    }
  },

  created () {
    this.getList();
  },
  methods: {
    getList () {

      this.selectedDataCopy = [];

      this.selectedDataCopy.push(this.selectedData);

    },
    handleDeleteser (val, row) {
      // 模态框删除按钮
      this.$confirm("是否确认删除本条数据?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "info",
      }).then(() => {
        this.selectedDataCopy = [];
        //数据回传
        this.$emit('tabRespon')
      });
    },
  },
};
</script>
